﻿@{
    ViewBag.Title = "TrainMenage";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script>
    $(function () {
        getshow()
            
    })

    function getshow()
    {
        $.ajax({
        type: "get",
        url: '/Astart/ShowTrainnumberInfor',
        success: function (d) {
            $(d).each(function (i, obj) {                                        
                var tr = "<tr><td>" + obj.Trainnumberid + "</td><td>" + obj.Trainname + "</td><td>" + obj.Starttime + "</td><td>" + obj.Endtime + "</td><td>" + obj.Stop + "</td><td>" + obj.Stoptime + "</td><td>" + obj.operation + "</td><td>" + obj.Farenumber + "</td><td><a href='FindTrainnumberInfor/?id=" + obj.Trainnumberid + "'>编辑</a><a href='#' onclick='DeleteTrainnumberInfor(" + obj.Trainnumberid + ")'>删除</a></td></tr>";
                $("#Table_show  tbody").append(tr);
            })
        }
    })
    }
    function DeleteTrainnumberInfor(id) {

        if (confirm("确认要删除吗？")) {

            $.ajax({
                url: '/Astart/DeleteTrainnumberInfor',
                type: 'post',
                data: {
                    id: id
                },
                dataAirMenage: 'json',
                success: function (d) {
                    if (d > 0) {
                        alert("删除成功");
                        $("#Table_show tbody").empty();
                        getshow();
                    }
                    else {
                        alert("删除失败");
                    }
                }
            })
        }
        
    }

        
         


</script>


<ul id="myTab" class="nav nav-tabs" style="margin-top:50px">
    <li class="active">
        <a href="#home" data-toggle="tab">
            车次信息维护
        </a>
    </li>
    <li><a href="#ios" data-toggle="tab">车次类别表</a></li>
    <li><a href="#zuowei" data-toggle="tab">座位信息维护</a></li>
    <li><a href="#city" data-toggle="tab">城市信息维护</a></li>
    <li><a href="#start" data-toggle="tab">车站信息维护</a></li>
    <li><a href="#Shiduan" data-toggle="tab">时段信息维护</a></li>
</ul>
<a href="/Astart/AddTrainnumberInfor">添加车次信息</a>
<div id="myTabContent" class="tab-content">
    <div class="tab-pane fade in active" id="home">
        <table id="Table_show" class="table">
            <thead>
                <tr>
                    <td>车次编号</td>
                    <td>车次名称</td>
                    <td>出发时间</td>
                    <td>抵达时间</td>
                    <td>经停站</td>
                    <td>经停时间</td>
                    <td>运行时间</td>
                    <td>车票剩余数量</td>
                    <td>操作</td>
                </tr>
            </thead>
            <tbody></tbody>
        </table>
        
    </div>
    <div class="tab-pane fade" id="ios">
        车次类别信息显示
    </div>
    <div class="tab-pane fade" id="zuowei">
        座位信息显示
    </div>
    <div class="tab-pane fade" id="city">
        城市信息显示
    </div>
    <div class="tab-pane fade" id="start">
        车站信息显示
    </div>
    <div class="tab-pane fade" id="Shiduan">
        时段信息显示
    </div>
</div>

